package com.luych.toolbox.data.service.dao;

import com.luych.toolbox.common.enums.DataBackupPlanStatus;
import com.luych.toolbox.data.service.entity.DataBackupPlan;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

public interface DataBackupPlanDao extends JpaRepository<DataBackupPlan, String>, JpaSpecificationExecutor<DataBackupPlan> {

    Page<DataBackupPlan> findByNameLike(String name, Pageable pageable);

    List<DataBackupPlan> findByStatusNot(DataBackupPlanStatus status);

    int countByDataSourceId(String dataSourceId);

    int countByDataAgentId(String dataAgentId);

    Optional<DataBackupPlan> findByDataAgentIdAndFile(String dataAgentId, String file);

}